<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

use Auth;

/**
 * 会员组验证
 */
class GroupRequest extends FormRequest
{
    public function authorize()
    {
        return Auth::check() && Auth::user()->isSuperAdmin;
    }

    public function rules()
    {
        return [
            'title' => ['required', 'between:3,20'],
            'site_num' => ['required', 'numeric', 'between:0,255'],
            'days' => ['required', 'numeric', 'between:3,20'],
        ];
    }

    public function attributes()
    {
        return [
            'title' => '会员组名称',
            'site_num' => '站点数量',
            'days' => '可用天数'
        ];
    }
}
